<?php

	// 商品名字
	$goodsName = "";

	// 商品价格
	$goodsPrice = "";

	// 商品单位
	$goodsDw = "";

	// 该商品可得积分
	$integral = 0;

	// 包含服务
	$include = "";

	// 地址
	$address = "";

	// 图片
	$goodsImg = Array();

	$file_content = file_get_contents("https://app.playnet.cc/index/goods/detail/id/45/wjkey/wj_580c6e9c079e12.52173588");
	$file_content = json_decode($file_content);
	foreach ($file_content as $key => $value) {
		// echo "string" . $key . $value;
		if ($key == "data") {
			foreach ($value as $key => $value) {
				if ($key == "goodsName") {
					$goodsName = $value;
				}
				if ($key == "goodsPrice") {
					$goodsPrice = $value;
				}
				if ($key == "goodsDw") {
					$goodsDw = $value;
				}
				if ($key == "integral") {
					$integral = $value;
				}

				// 图片
				if ($key == "goodsImg") {
					foreach ($value as $key => $valueImg) {
						// 
						foreach ($valueImg as $key => $valuePicUrl) {
							// echo "string = " . $valuePicUrl;
							if ($key == "pic") {
								$goodsImg[] = $valuePicUrl;
							}
						}
					}
				}

				// 地址
				if ($key == "goodsService") {
					foreach ($value as $key => $valueService) {
						if ($key == "address") {
							$address = $valueService;
						}
					}
				}
			}
		}
	}

	$ret = array();
	$ret["goodsName"] = $goodsName;
	$ret["goodsPrice"] = $goodsPrice;
	$ret["goodsDw"] = $goodsDw;
	$ret["goodsImg"] = $goodsImg;
	$ret["integral"] = $integral;
	$ret["address"] = $address;

	// var_dump($ret);
	echo json_encode($ret);



